﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Blo
{
    public class DictEquipExpBlo
    {
        public static int GetCostCoinToLevel(int quality,int level)
        {
            if(level <= 1)
            {
                return 0;
            }
            List<TableEquipExp> list = Dict.DictDataManager.Instance.tableEquipExpDao.GetByOneIndex(quality);
            return list[level - 2].coin;
        }

        public static int GetCostCoinFromLvToLv(int quality, int level1, int level2)
        {
            List<TableEquipExp> list = Dict.DictDataManager.Instance.tableEquipExpDao.GetByOneIndex(quality);

            int totalNeed = 0;
            for(int i = level1 - 1; i < level2 - 1; i++)
            {
                if (i >= list.Count)
                    break;

                totalNeed += list[i].coin;
            }

            return totalNeed;
        }

        public static int GetEquipMaxLevel(int quality)
        {
            List<TableEquipExp> list = Dict.DictDataManager.Instance.tableEquipExpDao.GetByOneIndex(quality);

            return list.Count;
        }
    }
}
